﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WebChatApi.Common.Audit
{
    /// <summary>
    /// Class for field comparison based on <see cref="ObjectComparison"/> class objects.
    /// </summary>
    public class FieldComparison
    {
        #region Properties

        /// <summary>
        /// Gets or sets the field identity.
        /// </summary>
        /// <value>
        /// The field identity.
        /// </value>
        public string FieldIdentity
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the left value.
        /// </summary>
        /// <value>
        /// The left value.
        /// </value>
        public string LeftValue
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the right value.
        /// </summary>
        /// <value>
        /// The right value.
        /// </value>
        public string RightValue
        {
            get;
            set;
        }

        #endregion

        #region Constructor

        /// <summary>
        /// Initializes a new instance of the <see cref="Changeset"/> class.
        /// </summary>
        public FieldComparison()
        {
        }

        #endregion

        /// <summary>
        /// Compares the value.
        /// </summary>
        /// <param name="ignoreCase">if set to <c>true</c> [ignore case].</param>
        /// <returns>Value indicating whether value is equivalent</returns>
        public bool CompareValue(bool ignoreCase = true)
        {
            return string.Compare(this.GetStringValue(LeftValue), this.GetStringValue(RightValue), ignoreCase) == 0;
        }
    }
}
